Traditional relational database optimizer code performs various functions when it processes a Structured Query Language (SQL) statement. The SQL optimizer uses many statistics that are stored in the relational database catalogue (or dictionary) to select an optimal access path when retrieving data from tables and views. Additionally the SQL optimizer uses rules and heuristics based on relational tuple calculus to make its access path selections. However, despite the tasks performed by the optimizer, a user can still submit valid but “malformed” SQL statements that will be processed unchanged by the optimizer. Processing of malformed statements can be highly inefficient to the database engine. This is especially burdensome when the SQL statements are stored and repeatedly executed.